<template>
  <header class="header">
      <h1>todos</h1>
      <input 
      class="new-todo" 
      placeholder="请输入任务名称" 
      autofocus 
      v-model="addValue"
      @keyup.enter="addFn"
      />
    </header>
</template>

<script>
export default {
  data(){
    return {
      addValue:''
    }
  },
methods:{
  addFn(){
    if(this.value==='')  return alert('请输入内容')
    this.$emit('addItem',this.addValue)
    addValue=''
  }
}
}
</script>

<style>

</style>